package gcu.module.notice.service;

import gcu.common.context.SecurityContextHolder;
import gcu.module.notice.dao.NoticeDao;
import gcu.module.notice.daomain.Notice;
import gcu.module.rbac.daomain.User;
import gcu.util.SFormt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by haol on 2016/9/29.
 */
@Service
public class NoticeService {
      @Autowired
      private NoticeDao noticeDao;

      public Notice getNotice(){
            return noticeDao.getNotice();
      }
      public void addNotice(Notice notice){
            User user = SecurityContextHolder.getUser();
            notice.setCreateTime(SFormt.NOWDATE_y_M_d());
            notice.setSetName(user.getRealName());
             noticeDao.addNotice(notice);
      }
}
